Skip to content

fix(interpreter): resolve namerefs in parameter expansion for assoc array subscripts#869

Merged
chaliy merged 1 commit intomainfrom
fix/issue-801-nameref-assoc-default
Mar 27, 2026
Merged

fix(interpreter): resolve namerefs in parameter expansion for assoc array subscripts#869
chaliy merged 1 commit intomainfrom
fix/issue-801-nameref-assoc-default

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 27, 2026

resolve_param_expansion_name didn't resolve namerefs before looking up array names for subscript access and bulk operations ([@], [*]). This caused ${ref[key]:-default} and ${ref[key]:+alt} to always treat the value as unset when ref was a nameref to an associative array.

Changes

  • Resolve namerefs for arr_name in the [@]/[*] bulk access path
  • Resolve namerefs for arr_name in the individual [key] subscript path
  • Add 4 spec tests covering :-, :+, and [@]:- through namerefs

Test plan

Closes #801

…rray subscripts

`resolve_param_expansion_name` didn't resolve namerefs before looking up
array names for subscript access and bulk operations (`[@]`, `[*]`).
This caused `${ref[key]:-default}` and `${ref[key]:+alt}` to always
treat the value as unset when `ref` was a nameref to an associative array.

The fix resolves namerefs for `arr_name` in both the `[@]`/`[*]` bulk
access path and the individual `[key]` subscript path within
`resolve_param_expansion_name`, matching the behavior of `expand_variable`.

Closes #801
@chaliy chaliy merged commit c246ad3 into main Mar 27, 2026
23 checks passed
@chaliy chaliy deleted the fix/issue-801-nameref-assoc-default branch March 27, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: local -n nameref with associative arrays — harness patterns

1 participant